/**
 * 
 */
package com.rapwaves.feeds.content.widgets;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
import com.rapwaves.feeds.content.beans.TextContent;

/**
 * @author asanthan
 * 
 */
public class TextContentUI extends Composite implements HasText {

	private static TextContentUiBinder uiBinder = GWT.create(TextContentUiBinder.class);

	interface TextContentUiBinder extends UiBinder<Widget, TextContentUI> {
	}

	private TextContent bean;

	public TextContentUI(TextContent bean) {
		initWidget(uiBinder.createAndBindUi(this));
		this.bean = bean;
		setText(bean.getText());
	}

	@UiField
	Label textContent;

	public void setText(String text) {
		textContent.setText(text);
	}

	/**
	 * Gets invoked when the default constructor is called and a string is
	 * provided in the ui.xml file.
	 */
	public String getText() {
		return textContent.getText();
	}

}
